<?php
function smarty_function_fileuploader($params, $smarty) {
    $template = "fileuploader.tpl";
    $title = "upload";
    $chgtitle = false;
    $name = "";
    $popuptitle = "Upload";
    $uploadfn = "startUpload";
    $req_width = 105;
    $req_height = 105;
    $req_minwidth = "";
    $req_minheight = "";
    $onchange = false;
    $imgWidth = false;

    $val = "";
    foreach ($params as $key=>$value) {
        if ($key == "title") { $title = $value; }
        else if ($key == "name") { $name = $value; }
        else if ($key == "uploadfn") { $uploadfn= $value; }
        else if ($key == "popuptitle") { $popuptitle = $value; }
        else if ($key == "req_width") { $req_width = $value; }
        else if ($key == "req_height") { $req_height = $value; }
        else if ($key == "value") { $val = $value; }
        else if ($key == "req_minwidth") { $req_minwidth = $value; }
        else if ($key == "req_minheight") { $req_minheight = $value; }
        else if ($key == "onchange") { $onchange = $value; }
        else if ($key == "imgwidth") { $imgWidth = $value; }
        else if ($key == "chgtitle") { $chgtitle = $value; }
    }
    $smarty->assign("name", $name);
    $smarty->assign("title", $title);
    $smarty->assign("uploadfn", $uploadfn);
    $smarty->assign("popuptitle", $popuptitle);
    $smarty->assign("req_width", $req_width);
    $smarty->assign("req_height", $req_height);
    $smarty->assign("req_minwidth", $req_minwidth);
    $smarty->assign("req_minheight", $req_minheight);
    $smarty->assign("onchange", $onchange);
    $smarty->assign("value", $val);
    $smarty->assign("imgwidth", $imgWidth);
    $smarty->assign("chgtitle", $chgtitle);

    return $smarty->fetch("plugins/$template");
}

?>
